{% from 'macros.html' import pagination %}
{% from 'product/macros.html' import product as product_macro %}
{% from 'shop/macros.html' import shop as shop_macro %}

{% extends "base.html" %}

{% block title %}
<title>{{ config['SITE_NAME'] }} - 店铺列表</title>
{% endblock %}

{% block body %}
<nav aria-label="breadcrumb">
  <ol class="breadcrumb">
    <li class="breadcrumb-item"><a href="/">首页</a></li>
    <li class="breadcrumb-item active" aria-current="page">店铺列表</li>
  </ol>
</nav>

{% for shop in shops %}
<div class="row py-3 border-bottom">
  <div class="col-6 col-md-4 col-lg-3">
    {{ shop_macro(shop) }}
  </div>
  <div class="col-6 col-md-8 col-lg-9">
    <div class="d-flex flex-wrap">
      {% for product in shop.get('products', [])[:3] %}
      {{ product_macro(product) }}
      {% endfor %}
    </div>
  </div>
</div>
{% endfor %}

{{ pagination((total / config['PAGINATION_PER_PAGE'])|round(0, 'ceil')|int, request.args.get('page', '1')|int, '.index') }}
{% endblock %}